import { Button, Space } from 'antd'
import type { ColumnsType } from 'antd/es/table'

export interface DataType {
  key: string
  name: string
  age: number
  address: string
  tags: string[]
}

export const columns: () => ColumnsType<DataType> = (
  clickEditDialog: () => void,
  shopping: () => void
): ColumnsType<DataType> => {
  return [
    {
      title: 'Id',
      dataIndex: 'id',
      key: 'id',
    },
    {
      title: 'Name',
      dataIndex: 'username',
      key: 'username',
      render: (text) => <a href="/a">{text}</a>,
    },
    {
      title: 'Password',
      dataIndex: 'password',
      key: 'password',
    },
    {
      title: 'Account',
      dataIndex: 'account',
      key: 'account',
    },
    {
      title: 'Age',
      dataIndex: 'age',
      key: 'age',
    },
    {
      title: 'Action',
      key: 'action',
      render: (_, record) => (
        <Space size="middle">
          <a href="/">Invite {record.name}</a>
          <a href="/">Delete</a>
          <Button type="primary" onClick={() => clickEditDialog(record)}>
            编辑
          </Button>
          <Button type="dashed" onClick={() => shopping()}>
            购物
          </Button>
        </Space>
      ),
    },
  ]
}
